/**
 * Created on 2007-03-09 00:28
 */
package game;

/**
 * @author David Wallin
 * 
 * A basic hand control with two buttons, left and right
 * Register an instance of this class to one of the positions in the
 * InputManager, and then register a Block with the controller to get
 * a working environment
 */
public class Control
{
	private Block		m_Block;
	
	public Control()
	{
		m_Block = null;
	}
	
	public void setBlock(Block block)
	{
		m_Block = block;
	}
	
	public void pressLeft()
	{
		if(m_Block != null)
		{
			m_Block.setPosition(m_Block.getMatrisXpos() - 1, m_Block.getMatrisYpos());
		}
	}
	
	public void pressRight()
	{
		if(m_Block != null)
		{
			m_Block.setPosition(m_Block.getMatrisXpos() + 1, m_Block.getMatrisYpos());
		}
	}
	
	public void pressRotate()
	{
		if(m_Block != null)
		{
			m_Block.rotate();
		}
	}
}
